package com.zhitong.ztblog.controllers;

import com.zhitong.ztblog.entity.Log;
import com.zhitong.ztblog.services.ILogService;
import com.zhitong.ztblog.utils.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin(origins = "*",maxAge = 3600)
@RestController
public class LogContro{

    @Autowired
    private ILogService logService;

    @GetMapping("/logs")
    public AjaxResponse getAll(){
        Log[] logs = logService.findAll();
        AjaxResponse success = AjaxResponse.success(logs);
        return success;
    }
}
